import React from 'react';
import { Button, Table } from 'antd';
import IconPro from '@/components/IconPro';
import AuthComponent from '@/utils/auth/AuthComponent';

const SettingTable = props => {
    const { onAdd, authCode = true, disabled = false, ...tableProps } = props;
    return (
        <div style={{ marginBottom: '24px' }}>
            <Table rowKey="id" pagination={false} {...tableProps} style={{ wordBreak: 'break-word' }} />
            <AuthComponent code={authCode}>
                <Button block type="dashed" style={{ margin: '16px 0 0' }} onClick={onAdd} disabled={disabled}>
                    <IconPro
                        type="iconadd_function_o"
                        style={{ marginRight: 6, fontSize: 14, color: 'rgb(0 0 0 / 65%)' }}
                    />
                    添加
                </Button>
            </AuthComponent>
        </div>
    );
};

export default SettingTable;
